package top.boycharse.blog.dao.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.boycharse.blog.bean.request.UserInfo;
import top.boycharse.blog.dao.bean.User;
import top.boycharse.blog.dao.repository.UserRepository;

import javax.transaction.Transactional;

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    @Transactional
    public User saveUser(User user) {
        return userRepository.save(user);
    }

    public User getUserByUserName(String username) {
        User user = userRepository.findByUserName(username);
        return user;
    }
}
